using System;
using Infinity.Common;

namespace Infinity.API.Core
{
	public class CommandCodeAction : CodeAction
	{
		public CommandCodeAction(Action action)
		{
			Action = Ensure.NotNull(action);
		}

		protected Action Action { get; set; }

		public override void Run()
		{
			OnExecuting(this);
			Action();
			OnExecuted(this);
		}
	}
}